{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">网站设置</div>
                <div class="layui-card-body">
                    <div class="layui-form" lay-filter="form">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                {volist name="systemGroup" id="vo"}
                                <li {if $key == 1}class="layui-this"{/if}>{$vo.name}</li>
                                {/volist}
                            </ul>

                            <div class="layui-tab-content">
                                {foreach $systemGroup as $key=>$vo }
                                <div class="layui-tab-item {if $key == 1}layui-show{/if}">
                                    {if array_key_exists($vo.id,$system)}
                                    {foreach $system[($key)] as $k=>$v }
                                    {if $v['status']}
                                    {if $v['type'] =='text'}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">{$v.name}</label>
                                        <div class="{if $v.display}layui-input-block{else /}layui-input-inline{/if}">
                                            <input type="text" name="{$v.field}" {if $v.required}lay-verify="required"{/if} placeholder="请输入{$v.name}" value="{$v.value}" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                                    </div>
                                    {elseif $v['type'] =='textarea'/}
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">{$v.name}</label>
                                        <div class="{if $v.display}layui-input-block{else /}layui-input-inline{/if}">
                                            <textarea name="{$v.field}" class="layui-textarea" placeholder="请输入{$v.name}">{$v.value}</textarea>
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                                    </div>
                                    {elseif $v['type'] =='editor'/}


                                    {elseif $v['type'] =='select'/}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">{$v.name}</label>
                                        <div class="{if $v.display}layui-input-block{else /}layui-input-inline{/if}">
                                            <select name="{$v.field}" lay-verify="required">
                                                <option value="">请选择</option>
                                                {foreach $v.setup.options as $kk=>$vv }
                                                <option {if $v.value == trim($vv.1)}selected{/if} value='{$vv.1}' >{$vv.0}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                                    </div>
                                    {elseif $v['type'] =='radio'/}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">{$v.name}</label>
                                        <div class="{if $v.display}layui-input-block{else /}layui-input-inline{/if}">
                                            {foreach $v.setup.options as $kk=>$vv }
                                            <input type="radio" name="{$v.field}" value="{$vv.1}" {if $v.value == trim($vv.1)}checked{/if} title="{$vv.0}">
                                            {/foreach}
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                                    </div>
                                    {elseif $v['type'] =='checkbox'/}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">{$v.name}</label>
                                        <div class="{if $v.display}layui-input-block{else /}layui-input-inline{/if}">
                                            {foreach $v.setup.options as $kk=>$vv }
                                            <input type="checkbox" name="{$v.field}[]" value="{$vv.1}" {in name="$vv.1" value="$v.value"}checked{/in} title="{$vv.0}">
                                            {/foreach}
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                                    </div>
                                    {elseif $v['type'] =='image'/}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">{$v.name}</label>
                                        <div class="layui-input-inline">
                                            <input name="{$v.field}" lay-verify="required" id="{$v.field}" value="{$v.value}" placeholder="{$v.name}链接" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                            <button type="button" class="layui-btn" id="{$v.field}Upload">
                                                <i class="layui-icon">&#xe67c;</i>上传{$v.name}
                                            </button>
                                            <button class="layui-btn layui-btn-primary" layadmin-event="{$v.field}Show">查看{$v.name}</button >
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                                    </div>
                                    {elseif $v['type'] =='file'/}


                                    {elseif $v['type'] =='datetime'/}


                                    {/if}
                                    <!---->
                                    {/if}
                                    {/foreach}
                                    {/if}
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit lay-filter="set_website">确认保存</button>
                                        </div>
                                    </div>
                                </div>
                                {/foreach}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot"/}
<script>
    layui.config({
        base: '__LAYADMIN__/',version: true
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','upload','system'],function() {
        var $= layui.$,admin = layui.admin,upload = layui.upload;
        <!--{foreach $systemGroup as $key=>$vo }-->
        <!--{if array_key_exists($vo.id,$system)}-->
        <!--{foreach $system[($key)] as $k=>$v }-->
        <!--{if $v['status']}-->
        <!--{if $v['type'] =='image'}-->
            var {$v.field} = $('#{$v.field}');
            upload.render({
                url: '/admin/Upfiles/upload.html?title={$v.field}'
                , elem: '#{$v.field}Upload'
                , done: function (res) {
                    if (res.code == 0) {
                        {$v.field}.val(res.url);
                        {$v.field}.parent().append('<input type="hidden" name="{$v.field}_aid" value="'+res.aid+'">')
                    } else {
                        layer.msg(res.msg, {icon: 5});
                    }
                }
            });
            //查看图片
            admin.events.{$v.field}Show = function (othis) {
                var src = {$v.field}.val();
                layer.photos({
                    photos: {
                        "title": "查看图片" //相册标题
                        , "data": [{
                            "src": src //原图地址
                        }]
                    }
                    , shade: 0.01
                    , closeBtn: 1
                    , anim: 5
                });
            };
        <!--{/if}-->
        <!--{/if}-->
        <!--{/foreach}-->
        <!--{/if}-->
        <!--{/foreach}-->
    })
</script>
</body>
</html>